<template>
  <div class="pages-contain-view">
    <el-card>
      <!-- 表格 -->
      <el-table v-loading="tableLoad" :data="normalTableData" stripe style="width: 100%">
        <el-table-column prop="number" label="编号">
        </el-table-column>
        <el-table-column prop="name" label="姓名" width="80">
        </el-table-column>
        <el-table-column prop="level" label="等级" width="120">
        </el-table-column>
        <el-table-column prop="date" label="最后登陆时间">
        </el-table-column>
        <el-table-column prop="email" label="邮箱">
        </el-table-column>
      </el-table>
      <!-- 分页 -->
      <div class="pagination_container">
        <el-pagination background layout="prev, pager, next" :page-count="pagination.count" @current-change="changePage">
        </el-pagination>
      </div>
    </el-card>
    <!-- <button @click="toEdit">编辑</button> -->
  </div>
</template>

<script>
import { normalTable } from "@/api/table";
export default {
  data() {
    return {
      normalTableData: [],
      tableLoad: false,
      pagination: {
        page: 1,
        count: 0
      }
    };
  },
  mounted() {
    this.getNormalTable(this.pagination);
    // console.error("this is a stable error!");
  },
  methods: {
    async getNormalTable(page) {
      this.tableLoad = true;
      let res = await normalTable(page);
      if (res) {
        this.tableLoad = false;
        this.normalTableData = res.list;
        this.pagination.count = res.count;
      }
    },
    changePage(ind) {
      this.pagination.page = ind;
      this.getNormalTable(this.pagination);
    }
  }
};
</script>

<style scoped>
</style>
